Skip to content

Conversation

@vpelikh
Copy link

@vpelikh vpelikh commented Jan 1, 2026

Description

This PR consists of two commits:

  • update to java 17 (minimum version for jackson 3)
  • update to jackson 3

Fixes: #4991

Type of Change

  • 🐛 Bug fix
  • ✨ New feature
  • ♻️ Refactor (non-breaking change)
  • 🧪 Tests
  • 📝 Documentation
  • 🧹 Chore (build or tooling)

Checklist

  • I have added/updated tests as needed
  • I have added/updated documentation where applicable
  • The PR title is descriptive
  • The code builds and passes tests locally
  • I have linked related issues (if any)

Screenshots / Additional Context

@vpelikh vpelikh force-pushed the update-to-java-17 branch from 7633f49 to 7b93974 Compare January 1, 2026 13:48
@vpelikh vpelikh changed the title feat: migrate to java 17 feat: migrate to jackson 3 Jan 3, 2026
@cbot59
Copy link

cbot59 commented Jan 4, 2026

I think we need to introduce constructor for ModelResolver(JsonMapper) and deprecate the old constructor so the newer release requires user to Jackson3 instead.

currently I have such usage on ModelResolver when using springdoc-openapi
Screenshot 2026-01-04 at 10 17 11

my first attempt to migrate to Jackson3 would be

public ModelResolver modelResolver(JsonMapper jsonMapper) {
        return new ModelResolver(jsonMapper);
    }

as it is more straightforward

changes:
- update maven-compiler-plugin to latest 3.14.1
- update maven-javadoc-plugin to latest 3.12.0
- update jacoco-maven-plugin to latest 0.8.14
- set maven.compiler.release to 17
- set source to 17 and update link to javadoc for maven-javadoc-plugin configuration
- set java-version to 17 in github workflows
- set java version to 17 in swagger-gradle-plugin
@vpelikh vpelikh force-pushed the update-to-java-17 branch from 0de7198 to f60ee1e Compare January 4, 2026 13:36
@vpelikh
Copy link
Author

vpelikh commented Jan 4, 2026

I have removed many of the changes associated with java 17, so the PR is now much smaller.

@cbot59, thanks for the comment! JsonMapper is a descendant of ObjectMapper, so return new ModelResolver(jsonMapper); should work without a new constructor.

@WilliamAGH
Copy link

Hey everyone -- thanks to @vpelikh, we now have Jackson 3 and Java 17 support.

But I didn't want to wait, so I have it available here! His branch is available as a dependency, just add this to your build.gradle file or pom.xml equivalent:

configurations.all {
    resolutionStrategy.dependencySubstitution {
        substitute(module("io.swagger.core.v3:swagger-core-jakarta"))
            .using(module("com.github.WilliamAGH.swagger-core:swagger-core-jakarta:jackson-3-SNAPSHOT"))
        substitute(module("io.swagger.core.v3:swagger-models-jakarta"))
            .using(module("com.github.WilliamAGH.swagger-core:swagger-models-jakarta:jackson-3-SNAPSHOT"))
        substitute(module("io.swagger.core.v3:swagger-annotations-jakarta"))
            .using(module("com.github.WilliamAGH.swagger-core:swagger-annotations-jakarta:jackson-3-SNAPSHOT"))
    }

@piotrooo
Copy link

@cbot59, thanks for the comment! JsonMapper is a descendant of ObjectMapper, so return new ModelResolver(jsonMapper); should work without a new constructor.

No, it doesn't, because the ObjectMapper used by Swagger comes from the com.fasterxml.jackson.databind package (Jackson v2), while in v3 the JsonMapper comes from tools.jackson.databind.

@KP-EV
Copy link

KP-EV commented Jan 27, 2026

Any update on this?

@larsf96
Copy link

larsf96 commented Jan 29, 2026

Any chance that a maintainer takes a look here?
Is there any workaround to use Spring Boot 4 with SpringDoc 3 without waiting for this?

@WilliamAGH
Copy link

Any chance that a maintainer takes a look here? Is there any workaround to use Spring Boot 4 with SpringDoc 3 without waiting for this?

Yes, I’ve had this workaround in use in production for the last 2 weeks:

#5031 (comment)

@larsf96
Copy link

larsf96 commented Jan 30, 2026

configurations.all {
resolutionStrategy.dependencySubstitution {
substitute(module("io.swagger.core.v3:swagger-core-jakarta"))
.using(module("com.github.WilliamAGH.swagger-core:swagger-core-jakarta:jackson-3-SNAPSHOT"))
substitute(module("io.swagger.core.v3:swagger-models-jakarta"))
.using(module("com.github.WilliamAGH.swagger-core:swagger-models-jakarta:jackson-3-SNAPSHOT"))
substitute(module("io.swagger.core.v3:swagger-annotations-jakarta"))
.using(module("com.github.WilliamAGH.swagger-core:swagger-annotations-jakarta:jackson-3-SNAPSHOT"))
}

This does not work for me:

***************************
APPLICATION FAILED TO START
***************************

Description:

An attempt was made to call a method that does not exist. The attempt was made from the following location:

    org.springdoc.core.providers.ObjectMapperProvider.<init>(ObjectMapperProvider.java:75)

The following method did not exist:

    'com.fasterxml.jackson.databind.ObjectMapper io.swagger.v3.core.util.Json31.mapper()'

The calling method's class, org.springdoc.core.providers.ObjectMapperProvider, was loaded from the following location:

    jar:file:/application/BOOT-INF/lib/springdoc-openapi-starter-common-3.0.1.jar!/org/springdoc/core/providers/ObjectMapperProvider.class

The called method's class, io.swagger.v3.core.util.Json31, is available from the following locations:

    jar:file:/application/BOOT-INF/lib/swagger-core-jakarta-jackson-3-52d4c245bb-1.jar!/io/swagger/v3/core/util/Json31.class
    jar:file:/application/BOOT-INF/lib/swagger-core-jakarta-2.2.41.jar!/io/swagger/v3/core/util/Json31.class

The called method's class hierarchy was loaded from the following locations:

    io.swagger.v3.core.util.Json31: file:/application/BOOT-INF/lib/swagger-core-jakarta-jackson-3-52d4c245bb-1.jar


Action:

Correct the classpath of your application so that it contains compatible versions of the classes org.springdoc.core.providers.ObjectMapperProvider and io.swagger.v3.core.util.Json31

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature] Support Jackson 3.x release line

6 participants